@extends('/home/zhuce/zhuce')
@section('title','找回密码')
  @section('content')
  <div class="welland"> 
   <img src="/Home/zhuce/Picture/logewm.gif" alt="" class="EWM" style="" /> 
   <!--LOGO--> 
   <div class="land_logo"> 
    <input type="hidden" value="" id="jihuo" /> 
    <div class="l land_logo_img"> 
     <a class="l" href="http://www.ugoshop.com" target="_blank"></a> 
     <span class="l findlogo"></span> 
    </div> 
    <p class="r kefuphonenum">已经注册，<a target="_blank" href="{{url('/home/login/login')}}">现在登录》</a></p> 
   </div> 
   <div class="regnav"> 
    <ul> 
     <!-- <li class="regnav1 on"><span class="icon4">手机注册</span></li>  -->
     <li  class="regnav1 on"><span class="icon2">邮箱找回密码</span></li> 
    </ul> 
   </div> 
   <!--regnav OVER--> 
   <!--框内开始--> 
   <div class="land_con clearfix"> 
    <!--邮箱注册开始--> 

 
    <div class="phonereg"> 
     <form action="{{url('/zhaohui/zhaohui')}}" method="post">
      <div class="item phone-regName"> 
		</div>
      <div class="item phone-regName"> 
       <span class="l labname1">邮箱：</span>
        <div>
        <input style="width: 400px;height: 30px;font-size: 20px;s" name="email" type="text" value="{{old('email')}}"/>
        <div style="display:none ">请输入邮箱</div>
        </div>
       </div>        
              
        <div class="item phone-regName"> 
        <div>
        <span class="l labname1">验证码:</span>
        <input style="width: 80px;height: 30px;font-size: 20px;" name="yanzhengma" type="text" value=""/>
        <span style="display:none">请输入验证码</span>
        <div style="padding-left:200px;padding-top:-250px">
        <img src="{{url('/zhuce/vode')}}" name="img" onclick="this.src=this.src+'?a=1'"style="cursor:pointer;padding-top:10px;width: 100px;height:40px" alt=""/>
        </div>
        </div>
       </div>
   
      <div class="item phone-regName" id="itemh2"> 
       <span class="l labname1"></span> 
       <div class="item-ifo l"> 
      <input type="hidden" value="" id="hidden1" /> 
       </div> 
      </div> 
      <div class="item phone-regName" id="itemh3"> 
       <span class="l labname1"></span> 
       <div class="item-ifo l" style="padding-top:30px"> 
        <input type="submit" id="btn1" class="registsubmit" value="" /> 
        <br /> 
        <label>如有疑问请点击<a class="cg" href="/help.html" target="_blank">帮助中心</a>，或拨打客服热线：<em>400-707-0707</em></label> 
       </div> 
      </div> 
      {{csrf_field()}}
     </form> 
    </div> 
   </div>
   <script type="text/javascript" src="/Home/zhuce/Scripts/jquery-1.8.3.min.js"></script>
   <script type="text/javascript">
   //定义全局变量
   var EMAIL = false;
   var MA = false;
   //绑定提交事件
   $('form').submit(function(){
    $('input').trigger('blur');
    if(EMAIL){
      return true;
    }
    return false;
   })
   //获取焦点
   $('input').focus(function(){
      $(this).next().show().css('color','green');
   })
   
   //失去焦点

   $('input[name=email]').blur(function(){
      var email = $(this).val();
      var reg = /^\w+@\w+\.(com|cn|org|net)$/;
      if(!reg.test(email)){
        $(this).next('div').show().html('邮箱格式不正确').css('color','red');
        EMAIL = false;
        return false;
      }
      var dd = $(this);
      $.ajaxSetup({
              headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
              }
      });
      $.ajax({
        url:"{{url('/zhaohui/info')}}",
        data:{email:email},
        type:'post',
        // datatype:'json',
        success:function(data){
          if(data == 2){
            dd.next('div').show().html('邮箱未注册,请核实是否正确').css('color','red');
            EMAIL = false;
            return false;
          }else{
            dd.next('div').css('display','none');
            EMAIL = true;
          }
        },
        error:function(){
          alert('ajax错误');
        },
        async:false,
      })
   });
  
  //验证码
  $('input[name=yanzhengma]').blur(function(){
    var ma = $(this).val();
    var aa = $(this);
    $.ajaxSetup({
              headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
              }
      });
    $.post("{{url('/zhaohui/yanzheng')}}",{ma:ma},function(data){
      if(data == 2){
        aa.next('span').show().html('验证码不正确').css('color','red');
        MA = false;
        return false;
      }else{
        aa.next('span').hide();
        MA = true;
      }
    })
  })   
   </script>

   <!--框内结束--> 
  </div>
  @endsection